﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using IQKS.AWP.DataAccessLayer;
using IQKS.AWP.BusinessObject;


namespace IQKS.AWP.BusinessAccessLayer
{
  public  class EmailTemplateMasterBAL
    {
        public DataSet GetEmailTemplateMaster()
        {
            DataSet objDs;
            try
            {
                objDs = new EmailTemplateMasterDAL().GetEmailTemplateMaster(0);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }


        public EmailTemplateMasterBO GetEmailTemplateMaster(params object[] param)
        {

            EmailTemplateMasterBO objLMBo;
            try
            {
                objLMBo = new EmailTemplateMasterBO();
                DataSet objDs;
                objDs = new EmailTemplateMasterDAL().GetEmailTemplateMaster(param);
                if (objDs != null)
                {
                    DataTable objDt = objDs.Tables[0];
                    if (objDt != null)
                    {
                        objLMBo.EmailTemplateID = Convert.ToInt32(objDt.Rows[0]["EmailTemplateID"]);
                        objLMBo.ActivityID = Convert.ToInt32(objDt.Rows[0]["ActivityID"]);
                        objLMBo.EmailSubject = Convert.ToString(objDt.Rows[0]["EmailSubject"]);
                        objLMBo.EmailTemplateText = Convert.ToString(objDt.Rows[0]["EmailTemplateText"]);
                        objLMBo.EmailTo = Convert.ToString(objDt.Rows[0]["EmailTo"]);
                        objLMBo.EmailBcc = Convert.ToString(objDt.Rows[0]["EmailBCC"]);
                        objLMBo.EmailCc = Convert.ToString(objDt.Rows[0]["EmailCC"]);
                        objLMBo.IsActive = Convert.ToBoolean(objDt.Rows[0]["IsActive"]);
                    }
                    else
                    {
                        objLMBo = null;
                    }
                }

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objLMBo;
        }


        public object SetEmailTemplateMaster(params object[] param)
        {
            try
            {
                return new EmailTemplateMasterDAL().SetEmailTemplateMaster(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public DataSet GetActivityBindBAL()
        {

            try
            {
                return new EmailTemplateMasterDAL().GetActivityBindDAL(0);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
    }
}
